<?php

class TransactionCentral_UtilityFunctions
{
    private function __construct() {}
    
    public static function transactionCentralAutoLoader($class)
    {
        include_once str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php';
    } 
    
    public static function fromCamelCase($str) 
    {
        $str[0] = strtolower($str[0]);
        $func = create_function('$c', 'return "_" . strtolower($c[1]);');
        return preg_replace_callback('/([A-Z])/', $func, $str);
    }
    
    public static function toCamelCase($str, $capitalise_first_char = false) 
    {
        if($capitalise_first_char) {
          $str[0] = strtoupper($str[0]);
        }
        
        $func = create_function('$c', 'return strtoupper($c[1]);');
        return preg_replace_callback('/_([a-z])/', $func, $str);
    }
}